package com.example.shopping.dao;

import com.example.shopping.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/*
Create by 苍狼 于 2020/1/16
站在巅峰看世界，
落在深渊思人生。
*/
//用户
@Repository
public interface IUsrDao {


    //登录
    @Select("select * from `user` where uname=#{uname} and upwd=#{upwd}")
    User login(String uname, String upwd);

    //新增
    @Insert("insert into `user`(uname,upwd) values(#{uname},#{upwd})")
    int add(User user);

    //删除
    @Delete("delete from `user` where id=#{id}")
    int delete(int id);

    //根据shrio查询所在对象
    @Select("select * from `user` where uname=#{uname} ")
    User selectByUname(String uname);

}
